﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserName"]==null && Session["PassWord"]==null)
            {
                Response.Redirect("WebForm1.aspx");
            }
            if (Application["CharRoom"]==null)   
            {
                Application["CharRoom"] = new Panel();
            }
            Panel1.Controls.Add((Panel)Application["CharRoom"]);

           
        }


        
        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = Session["UserName"].ToString();
            string time = DateTime.Now.ToString();
            string speak = TextBox1.Text;
            Literal1.Text = name + " " + time + " " + "<br/>" + "     " + speak + "<br/>" + "                ";
            ((Panel)Application["CharRoom"]).Controls.Add(Literal1);
            TextBox1.Text = null;
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Application["CharRoom"] = null;
            Response.Redirect("WebForm1.aspx");
            Session.Abandon();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {

        }

   
    }
}